package my.sweep_tchap;
/**
 *
 * @author Tyler Chapman
 * @version 0.1
 * 
 * The user is sent to this page if there is malformed data for the street they selected 
 * on the StreetPage or they input a street in the StreetInput page that doesn't 
 * exist in the database. This gives them information of how to find alternative
 * street sweeping times for the street their car is located on.
 * 
 */

import java.io.InputStream;
import org.xmlvm.iphone.CGRect;
import org.xmlvm.iphone.UIColor;
import org.xmlvm.iphone.UIFont;
import org.xmlvm.iphone.UILabel;
import org.xmlvm.iphone.UIScreen;
import org.xmlvm.iphone.UITextView;
import org.xmlvm.iphone.UIView;
import org.xmlvm.iphone.UIViewController;

public class ErrorPage extends UIViewController{
	public InputStream input;
	
	public void setLabel(UILabel label, String text, UIView root){
		/*
		 * Standard method to put in all the essential attributes for 
		 * a UILabel. It needs to be called once per label.
		 */
		UIFont font1 = UIFont.fontWithNameSize("AmericanTypewriter", 24);
    	UIColor back = UIColor.groupTableViewBackgroundColor;
		label.setBackgroundColor(back);
		label.setFont(font1);
		label.setTextAlignment(1);
		label.setText(text);		
		root.addSubview(label);
	}
	
	public void setTextView(UITextView label, String text, UIView root){
		/*
		 * Standard method to put in all the essential attributes for 
		 * a UITextView. It needs to be called once per textView.
		 */
		UIColor back = UIColor.groupTableViewBackgroundColor;
       	UIFont font1 = UIFont.fontWithNameSize("AmericanTypewriter", 24);
       	label.setFont(font1);
		label.setBackgroundColor(back);
    	label.setEditable(false);
       	label.setText(text);
    	label.setTextAlignment(1);
    	label.setAutoresizingMask(1);
    	root.addSubview(label);
	}
	
	
	public void loadView() {
       	super.loadView();
    	UIView root = new UIView(UIScreen.mainScreen().getApplicationFrame());
    	UIColor back = UIColor.groupTableViewBackgroundColor;
    	root.setBackgroundColor(back);
    	UILabel label1 = new UILabel(new CGRect(0, 90, UIScreen.mainScreen().getApplicationFrame().size.width, 30));
       	UILabel label2 = new UILabel(new CGRect(0, 130, UIScreen.mainScreen().getApplicationFrame().size.width, 30));
       	UITextView label3 = new UITextView(new CGRect(0, 170, UIScreen.mainScreen().getApplicationFrame().size.width, 30));
       	UILabel label4 = new UILabel(new CGRect(0, 210, UIScreen.mainScreen().getApplicationFrame().size.width, 30));
       	UITextView label5 = new UITextView(new CGRect(0, 240, UIScreen.mainScreen().getApplicationFrame().size.width, 40));
       	UILabel label6 = new UILabel(new CGRect(0, 285, UIScreen.mainScreen().getApplicationFrame().size.width, 30));
       	
       	this.setLabel(label1, "There is no listing", root);
       	this.setLabel(label2, "connect to", root);
       	this.setLabel(label4, "or call", root);
       	this.setLabel(label6, "for more info", root);
       	//website and phone number for the department of public works
       	this.setTextView(label3, "gispub02.sfgov.org/website/sfviewer/", root);
       	this.setTextView(label5, "(415) 554-6920", root);
        
       	UIFont font2 = UIFont.fontWithNameSize("AmericanTypewriter", 18);
    	label3.setFont(font2);
    	setView(root);
	}
}
